********************************************************************************
***************************** Replication Code for: ****************************
************** Objective Numeracy Exacerbates Framing Effects from *************
********************* Decision-Making Under Political Risk ********************* 
********************************************************************************

*Fitz, Stecula, Hitt, and Saunders (2024) 
*Corresponds with manuscript accepted for publication in Scientific Reports
*DOI: 10.1038/s41598-024-61099-y 

*To begin this analysis, first download the following Stata Data file, found in the uploaded supporting materials: "Replication Data for Objectively Numerate.dta"

*The following modules was also used in this analysis:

	*Module to calculate summated scale/indexed variables
	*ssc install sumscale

********************************************************************************
******************* Variable Set-Up and Coding (Commented Out) *****************
******************************************************************************** 

// destring, replace 

****************************** Attention Check *********************************

// label define colorcheck ///
// 0 "Incorrect" 1 "Correct" 
// label values colorcheck colorcheck

******************************** Demographics **********************************

*Education
// gen educationx = education
// recode educationx (6=5) (5=6)
// label var educationx ///
// "Education"
// label define educationx ///
// 1 "1 Did not complete HS" 2 "2 HS or GED" 3 "3 Some college" 4 "4 College graduate" 5 "5 Some postgraduate" 6 "Postgraduate degree"
// label values educationx educationx 
// recast double educationx

// gen education01 = (educationx-1)/5
// label var education01 ///
// "Education"
// recast double education01

*Income: omits "prefer not to say"
// gen incomex = income 
// replace incomex = . if income == 10
// label var incomex ///
// "Income"
// label define incomex ///
// 1 "1 Under 20,000" 2 "2 20,000-39,999" 3 "3 40,000-59,000" 4 "4 60,000-79,999" 5 "5 80,000-99,999" 6 "6 100,000-124,999" 7 "7 125,000-149,999" 8 "8 150,000-199,999" 9 "9 200,000 and over" 
// label values incomex incomex 
// recast double incomex

// gen income01 = (incomex-1)/8
// label var income01 ///
// "Income"
// recast double income01

*Gender: Female/non-female
// gen gender01 = gender
// recode gender01 (1=0) (2=1) (3=0) 
// label var gender01 ///
// "Gender"
// label define gender01 ///
// 0 "0 Not female" 1 "1 female"
// label values gender01 gender01 
// recast double gender01 

*Age
// gen agex = age_1
// replace agex = . if age_1 <18
// label var agex ///
// "Age"
// recast double agex

// gen age01 = (agex-18)/82
// label var age01 ///
// "Age"
// recast double age01

*Race: White/non-white 
// destring race, generate(racex) ignore(`","')
// gen race01 = racex 
// replace race01 = . if racex == 9
// recode race01 (1=1) (nonmiss=0)
// label var race01 ///
// "Race"
// label define race01 ///
// 0 "0 Non-white" 1 "1 White"
// label values race01 race01 
// recast double race01 

*Ethnicity: Hispanic or Latino/non-Hispanic or Latino
// gen ethnicity01 = hispanic 
// recode ethnicity01 (2=0)
// label var ethnicity01 ///
// "Ethnicity"
// label define ethnicity01 ///
// 0 "0 Not Hispanic or Latino" 1 "1 Hispanic or Latino" 
// label values ethnicity01 ethnicity01 
// recast double ethnicity01 

*Religion: reverse coded 
// gen religionx = religion 
// recode religionx (1=5) (2=4) (4=2) (5=1)
// label var religionx ///
// "Religiosity"
// label define religionx ///
// 1 "1 Very inactive" 2 "2 Moderately inactive" 3 "3 Neither active nor inactive" 4 "4 Moderately active" 5 "5 Very active"
// label values religionx religionx 
// recast double religionx 

// gen religion01 = (religionx-1)/4
// label var religion01 ///
// "Religiosity" 
// recast double religion01 

*Party ID 
// gen pid7x = .
// replace pid7x = 1 if partyid == 2 & strongdem == 1
// replace pid7x = 2 if partyid == 2 & strongdem == 2
// replace pid7x = 3 if partyid == 3 & lean == 1 
// replace pid7x = 4 if partyid == 3 & lean == 3 
// replace pid7x = 5 if partyid == 3 & lean == 2
// replace pid7x = 6 if partyid == 1 & strongrep == 2
// replace pid7x = 7 if partyid == 1 & strongrep == 1
// label var pid7x ///
// "Party ID"
// label define pid7x ///
// 1 "1 Strong Democrat" 2 "2 Not very strong Democrat" 3 "3 Independent-Democrat" 4 "4 Independent" 5 "5 Independent-Republican" 6 "6 Not very strong Republican" 7 "7 Strong Republican" 
// label values pid7x pid7x 
// recast double pid7x 

// gen pid701 = (pid7x-1)/6
// label var pid701 ///
// "Party ID" 
// recast double pid701 

*Ideology
// gen ideologyx = ideology 
// label var ideologyx ///
// "Ideology"
// label define ideologyx ///
// 1 "1 Extremely liberal" 2 "2 Liberal" 3 "3 Slightly liberal" 4 "4 Moderate" 5 "5 Slightly conservative" 6 "6 Conservative" 7 "7 Extremely conservative" 
// label values ideologyx ideologyx 
// recast double ideologyx 

// gen ideology01 = (ideologyx-1)/6 
// label var ideology01 ///
// "Ideology" 
// recast double ideology01 

***************************** Political Knowledge ******************************

// alpha pk1 pk2 pk3 pk4 pk5 pk6, item
// sumscale, f1(pk1 pk2 pk3 pk4 pk5 pk6) fdummy
// rename Factor1_dsum polknowx 
// label var polknowx ///
// "Political Knowledge"
// recast double polknowx 

// gen polknow01 = (polknowx)/6
// label var polknow01 ///
// "Political Knowledge"
// recast double polknow01 

********************************** Numeracy ************************************

*Numeracy 1 (Correct Answer: 500 times) 
// tab numeracy1
// gen n1x = numeracy1 
// replace n1x = "0" if numeracy1 == "1"
// replace n1x = "1" if numeracy1 == ",5"
// replace n1x = "1" if numeracy1 == ".50"
// replace n1x = "1" if numeracy1 == "1 in 2"
// replace n1x = "1" if numeracy1 == "1/2"
// replace n1x = "1" if numeracy1 == "50 percent"
// replace n1x = "1" if numeracy1 == "50 percent "
// replace n1x = "1" if numeracy1 == "50%"
// replace n1x = "1" if numeracy1 == "50% "
// replace n1x = "1" if numeracy1 == "50% of the time"
// replace n1x = "1" if numeracy1 == "50% of the time, barring small random.."
// replace n1x = "1" if numeracy1 == "50% of the time."
// replace n1x = "1" if numeracy1 == "50%."
// replace n1x = "1" if numeracy1 == "50-50"
// replace n1x = "1" if numeracy1 == "50-50 chance"
// replace n1x = "1" if numeracy1 == "500"
// replace n1x = "1" if numeracy1 == "500 "
// replace n1x = "1" if numeracy1 == "500 but that is unlikely"
// replace n1x = "1" if numeracy1 == "500 times"
// replace n1x = "1" if numeracy1 == "500t"
// replace n1x = "1" if numeracy1 == "50:50"
// replace n1x = "1" if numeracy1 == "About half"
// replace n1x = "1" if numeracy1 == "About half "
// replace n1x = "1" if numeracy1 == "Approx. 50% of the time"
// replace n1x = "1" if numeracy1 == "Around 500 times"
// replace n1x = "1" if numeracy1 == "At least 500"
// replace n1x = "1" if numeracy1 == "Half"
// replace n1x = "1" if numeracy1 == "Half "
// replace n1x = "1" if numeracy1 == "Half exactly"
// replace n1x = "1" if numeracy1 == "Half of the time"
// replace n1x = "1" if numeracy1 == "Half of the time avarage"
// replace n1x = "1" if numeracy1 == "Half the  time"
// replace n1x = "1" if numeracy1 == "Half the time"
// replace n1x = "1" if numeracy1 == "Half the time."
// replace n1x = "1" if numeracy1 == "Half the time. 500 times."
// replace n1x = "1" if numeracy1 == "Yes 50/50"
// replace n1x = "1" if numeracy1 == "about 50% of the time + or - 20%"
// replace n1x = "1" if numeracy1 == "about 500"
// replace n1x = "1" if numeracy1 == "about half the time"
// replace n1x = "1" if numeracy1 == "approximately 500 times"
// replace n1x = "1" if numeracy1 == "half" 
// replace n1x = "1" if numeracy1 == "half the time"
// replace n1x = "1" if numeracy1 == "half the time "
// replace n1x = "1" if numeracy1 == "half, 500 times"
// replace n1x = "1" if numeracy1 == "roughly 50%"

// destring n1x, generate(n1) force
// recode n1 (1=1) (nonmiss = 0) (miss = 0)
// recast double n1

*Numeracy 2 (Correct Answer: 10 persons out of 1000)
// tab numeracy2
// gen n2x = numeracy2 
// replace n2x = "1" if numeracy2 == " 10"
// replace n2x = "1" if numeracy2 == "10"
// replace n2x = "1" if numeracy2 == "10 "
// replace n2x = "1" if numeracy2 == "10 people"
// replace n2x = "1" if numeracy2 == "10 people "
// replace n2x = "1" if numeracy2 == "10 people would win a $10 prize."
// replace n2x = "1" if numeracy2 == "10 people, if I can still do simple math"
// replace n2x = "1" if numeracy2 == "10 persons"
// replace n2x = "1" if numeracy2 == "10."
// replace n2x = "1" if numeracy2 == "10.."
// replace n2x = "1" if numeracy2 == "10.0"
// replace n2x = "1" if numeracy2 == "10.00"
// replace n2x = "1" if numeracy2 == "10.000"
// replace n2x = "1" if numeracy2 == "10?" 
// replace n2x = "1" if numeracy2 == "1o"
// replace n2x = "1" if numeracy2 == "Around ten"
// replace n2x = "1" if numeracy2 == "Ten"
// replace n2x = "1" if numeracy2 == "Theoretically 10 people"

// destring n2x, generate(n2) force
// recode n2 (1=1) (nonmiss = 0) (miss = 0)
// recast double n2

*Numeracy 3 (Correct Answer: 0.1%)
// tab numeracy3 
// gen n3x = numeracy3 
// replace n3x = "0" if numeracy3 == " 0.10%"
// replace n3x = "0" if numeracy3 == "1"
// replace n3x = "1" if numeracy3 == "0.10%"
// replace n3x = "1" if numeracy3 == "%.1"
// replace n3x = "1" if numeracy3 == "%0.1"
// replace n3x = "1" if numeracy3 == "%0.10"
// replace n3x = "1" if numeracy3 == ",0.1"
// replace n3x = "1" if numeracy3 == ". 1"
// replace n3x = "1" if numeracy3 == "..1"
// replace n3x = "1" if numeracy3 == "..1%"
// replace n3x = "1" if numeracy3 == ".1"
// replace n3x = "1" if numeracy3 == ".1 %"
// replace n3x = "1" if numeracy3 == ".1 per cent"
// replace n3x = "1" if numeracy3 == ".1 percent"
// replace n3x = "1" if numeracy3 == ".1 percent "
// replace n3x = "1" if numeracy3 == ".1%"
// replace n3x = "1" if numeracy3 == ".10"
// replace n3x = "1" if numeracy3 == ".10 %"
// replace n3x = "1" if numeracy3 == ".10%"
// replace n3x = "1" if numeracy3 == "0,1"
// replace n3x = "1" if numeracy3 == "0.1"
// replace n3x = "1" if numeracy3 == "0.1 "
// replace n3x = "1" if numeracy3 == "0.1 %"
// replace n3x = "1" if numeracy3 == "0.1 percent" 
// replace n3x = "1" if numeracy3 == "0.1%"
// replace n3x = "1" if numeracy3 == "0.10%"
// replace n3x = "1" if numeracy3 == "0.10% chance of winning the car."
// replace n3x = "1" if numeracy3 == "00.1"
// replace n3x = "1" if numeracy3 == "000,1"
// replace n3x = "1" if numeracy3 == "0.1%"
// replace n3x = "1" if numeracy3 == "1/10 of 1%"
// replace n3x = "1" if numeracy3 == "1/10%"
// replace n3x = "1" if numeracy3 == "one tenth on one percent"

// destring n3x, generate(n3) force
// recode n3 (1=1) (nonmiss = 0) (miss = 0)
// recast double n3

*Numeracy 4
// gen num4x = numeracy4 
// recode num4x (1=0) (2=0) (3=1) (miss=0)
// recast double num4x

*gen n4 = num4x
*recast double n4 

*Numeracy 5
*gen num5x = numeracy5 
*recode num5x (1=0) (2=1) (3=0) (miss=0)
*recast double num5x

*gen n5 = num5x 
*recast double n5

*Numeracy 6 (Correct Answer: 2%)
*tab numeracy6
*gen n6x = numeracy6
*replace n6x = "0" if numeracy6 == "1"
*replace n6x = "1" if numeracy6 == "%2"
// replace n6x = "1" if numeracy6 == "2"
// replace n6x = "1" if numeracy6 == "2 "
// replace n6x = "1" if numeracy6 == "2 %"
// replace n6x = "1" if numeracy6 == "2 % "
// replace n6x = "1" if numeracy6 == "2 % in ten years"
// replace n6x = "1" if numeracy6 == "2 % in ten years "
// replace n6x = "1" if numeracy6 == "2 0/0 in 10 yrs" 
// replace n6x = "1" if numeracy6 == "2 PER CENT"
// replace n6x = "1" if numeracy6 == "2 every 10"
// replace n6x = "1" if numeracy6 == "2 in 10"
// replace n6x = "1" if numeracy6 == "2 in ten"
// replace n6x = "1" if numeracy6 == "2 in ten years"
// replace n6x = "1" if numeracy6 == "2 in ten years "
// replace n6x = "1" if numeracy6 == "2 per cent"
// replace n6x = "1" if numeracy6 == "2 per cent "
// replace n6x = "1" if numeracy6 == "2 per cent in 10 years"
// replace n6x = "1" if numeracy6 == "2 percent" 
// replace n6x = "1" if numeracy6 == "2 percent "
// replace n6x = "1" if numeracy6 == "2 percent  in 10yrs2"
// replace n6x = "1" if numeracy6 == "2 percent chance"
// replace n6x = "1" if numeracy6 == "2 percent in 10 years" 
// replace n6x = "1" if numeracy6 == "2 percent in 10 years "
// replace n6x = "1" if numeracy6 == "2$"
// replace n6x = "1" if numeracy6 == "2%"
// replace n6x = "1" if numeracy6 == "2% "
// replace n6x = "1" if numeracy6 == "2%  in 10 years"
// replace n6x = "1" if numeracy6 == "2% 2x1=2"
// replace n6x = "1" if numeracy6 == "2% 8n ten years"
// replace n6x = "1" if numeracy6 == "2% IN TEN YEARS"
// replace n6x = "1" if numeracy6 == "2% in 10"
// replace n6x = "1" if numeracy6 == "2% in 10 Years"
// replace n6x = "1" if numeracy6 == "2% in 10 year"
// replace n6x = "1" if numeracy6 == "2% in 10 years"
// replace n6x = "1" if numeracy6 == "2% in 10 years "
// replace n6x = "1" if numeracy6 == "2% in 10 years."
// replace n6x = "1" if numeracy6 == "2% in 10 yrs"
// replace n6x = "1" if numeracy6 == "2% in 10 yrs."
// replace n6x = "1" if numeracy6 == "2% in 10years" 
// replace n6x = "1" if numeracy6 == "2% in ten"
// replace n6x = "1" if numeracy6 == "2% in ten years"
// replace n6x = "1" if numeracy6 == "2% in ten years "
// replace n6x = "1" if numeracy6 == "2% in ten years 2"
// replace n6x = "1" if numeracy6 == "2% in ten years."
// replace n6x = "1" if numeracy6 == "2% on ten years"
// replace n6x = "1" if numeracy6 == "2% risk in ten years"
// replace n6x = "1" if numeracy6 == "2% ten years"
// replace n6x = "1" if numeracy6 == "2% ... ?"
// replace n6x = "1" if numeracy6 == "2%."
// replace n6x = "1" if numeracy6 == "2%1 in"
// replace n6x = "1" if numeracy6 == "2%2"
// replace n6x = "1" if numeracy6 == "2%2%"
// replace n6x = "1" if numeracy6 == "2%in ten years"
// replace n6x = "1" if numeracy6 == "2,percent"
// replace n6x = "1" if numeracy6 == "2.%"
// replace n6x = "1" if numeracy6 == "2percent"
// replace n6x = "1" if numeracy6 == "2percent "
// replace n6x = "1" if numeracy6 == "B is 2%"

// destring n6x, generate(n6) force
// recode n6 (1=1) (nonmiss = 0) (miss = 0)
// recast double n6 

*Numeracy 7 (Correct Answer: 2 out of 100)
// tab numeracy7
// gen n7x = numeracy7
// replace n7x = "0" if numeracy7 == "1"
// replace n7x = "1" if numeracy7 == " 2"
// replace n7x = "1" if numeracy7 == "2"
// replace n7x = "1" if numeracy7 == "2 "
// replace n7x = "1" if numeracy7 == "2  in 100"
// replace n7x = "1" if numeracy7 == "2  in 100 in ten years"
// replace n7x = "1" if numeracy7 == "2 /100"
// replace n7x = "1" if numeracy7 == "2 IN 100"
// replace n7x = "1" if numeracy7 == "2 IN 100 IN TEN YEARS10"
// replace n7x = "1" if numeracy7 == "2 IN 100 IN TEN YRS."
// replace n7x = "1" if numeracy7 == "2 en 100"
// replace n7x = "1" if numeracy7 == "2 in !00"
// replace n7x = "1" if numeracy7 == "2 in 100"
// replace n7x = "1" if numeracy7 == "2 in 100 10 years"
// replace n7x = "1" if numeracy7 == "2 in 100 in 10 years"
// replace n7x = "1" if numeracy7 == "2 in 100 in 10 years "
// replace n7x = "1" if numeracy7 == "2 in 100 in 10 years."
// replace n7x = "1" if numeracy7 == "2 in 100 in 10 yers"
// replace n7x = "1" if numeracy7 == "2 in 100 in 10 yrs"
// replace n7x = "1" if numeracy7 == "2 in 100 in ten year"
// replace n7x = "1" if numeracy7 == "2 in 100 in ten years"
// replace n7x = "1" if numeracy7 == "2 in 100 in ten years "
// replace n7x = "1" if numeracy7 == "2 in 100 or 2%"
// replace n7x = "1" if numeracy7 == "2 in 100????"
// replace n7x = "1" if numeracy7 == "2 in a 100 in 10 yrs."
// replace n7x = "1" if numeracy7 == "2 in a hundred"
// replace n7x = "1" if numeracy7 == "2 in a100"
// replace n7x = "1" if numeracy7 == "2 in 10 years" 
// replace n7x = "1" if numeracy7 == "2 in100"
// replace n7x = "1" if numeracy7 == "2 in100 in 10 years"
// replace n7x = "1" if numeracy7 == "2 in100 in ten years"
// replace n7x = "1" if numeracy7 == "2 in100 in ten years1"
// replace n7x = "1" if numeracy7 == "2 inn 100"
// replace n7x = "1" if numeracy7 == "2 of 100 in 10 yrs"
// replace n7x = "1" if numeracy7 == "2 out of 100"
// replace n7x = "1" if numeracy7 == "2-100"
// replace n7x = "1" if numeracy7 == "2/100"
// replace n7x = "1" if numeracy7 == "2in 100"
// replace n7x = "1" if numeracy7 == "2in100"

// destring n7x, generate(n7) force
// recode n7 (1=1) (nonmiss = 0) (miss = 0)
// recast double n7

*Numeracy 8a (Correct Answer: 10 out of 100)
// tab numeracy8a
// gen n8ax = numeracy8a
// replace n8ax = "0" if numeracy8a == "1"
// replace n8ax = "1" if numeracy8a == "10"
// replace n8ax = "1" if numeracy8a == "10 "
// replace n8ax = "1" if numeracy8a == "10 de 100"
// replace n8ax = "1" if numeracy8a == "10 in  100"
// replace n8ax = "1" if numeracy8a == "10 in 100"
// replace n8ax = "1" if numeracy8a == "10 out of 100"
// replace n8ax = "1" if numeracy8a == "10 people"
// replace n8ax = "1" if numeracy8a == "10 people "
// replace n8ax = "1" if numeracy8a == "10 people infected"
// replace n8ax = "1" if numeracy8a == "10 persons"
// replace n8ax = "1" if numeracy8a == "10 roughly"
// replace n8ax = "1" if numeracy8a == "10."
// replace n8ax = "1" if numeracy8a == "10.000"
// replace n8ax = "1" if numeracy8a == "10/100"
// replace n8ax = "1" if numeracy8a == "Ten"
// replace n8ax = "1" if numeracy8a == "ten"

// destring n8ax, generate(n8a) force
// recode n8a (1=1) (nonmiss = 0) (miss = 0)
// recast double n8a

*Numeracy 8b (Correct Answer: 100 out of 1000) 
// tab numeracy8b
// gen n8bx = numeracy8b
// replace n8bx = "0" if numeracy8b == "1"
// replace n8bx = "1" if numeracy8b == "100"
// replace n8bx = "1" if numeracy8b == "100 "
// replace n8bx = "1" if numeracy8b == "100 in 1000"
// replace n8bx = "1" if numeracy8b == "100 people"
// replace n8bx = "1" if numeracy8b == "100 people "
// replace n8bx = "1" if numeracy8b == "100 persons"
// replace n8bx = "1" if numeracy8b == "100 roughly"
// replace n8bx = "1" if numeracy8b == "100/1000"

// destring n8bx, generate(n8b) force
// recode n8b (1=1) (nonmiss = 0) (miss = 0)
// recast double n8b

*Numeracy 9 (Correct Answer: 20%) 
// tab numeracy9
// gen n9x = numeracy9
// replace n9x = "0" if numeracy9 == "1"
// replace n9x = "1" if numeracy9 == "%20"
// replace n9x = "1" if numeracy9 == "20"
// replace n9x = "1" if numeracy9 == "20 "
// replace n9x = "1" if numeracy9 == "20 %"
// replace n9x = "1" if numeracy9 == "20 % chance"
// replace n9x = "1" if numeracy9 == "20 PERCENT"
// replace n9x = "1" if numeracy9 == "20 o/o"
// replace n9x = "1" if numeracy9 == "20 per cent"
// replace n9x = "1" if numeracy9 == "20 percent"
// replace n9x = "1" if numeracy9 == "20 percent "
// replace n9x = "1" if numeracy9 == "20%"
// replace n9x = "1" if numeracy9 == "20% "
// replace n9x = "1" if numeracy9 == "20% chance"
// replace n9x = "1" if numeracy9 == "20% chance of getting the disease."
// replace n9x = "1" if numeracy9 == "20%, r20r"
// replace n9x = "1" if numeracy9 == "20r"

// destring n9x, generate(n9) force
// recode n9 (1=1) (nonmiss = 0) (miss = 0)
// recast double n9

*Numeracy 10 (Correct Answer: 5 people) 
// tab numeracy10
// gen n10x = numeracy10
// replace n10x = "0" if numeracy10 == "1"
// replace n10x = "1" if numeracy10 == " 5"
// replace n10x = "1" if numeracy10 == "05"
// replace n10x = "1" if numeracy10 == "5"
// replace n10x = "1" if numeracy10 == "5 "
// replace n10x = "1" if numeracy10 == "5 people"
// replace n10x = "1" if numeracy10 == "5 people "
// replace n10x = "1" if numeracy10 == "Five"
// replace n10x = "1" if numeracy10 == "⚅5" 

// destring n10x, generate(n10) force
// recode n10 (1=1) (nonmiss = 0) (miss = 0)
// recast double n10

*11-Item Numeracy Index 
// alpha n1 n2 n3 n4 n5 n6 n7 n8a n8b n9 n10, item
// sumscale, f1(n1 n2 n3 n4 n5 n6 n7 n8a n8b n9 n10) fdummy
// rename Factor1_dsum numindex
// label var numindex ///
// "Numeracy: Additive Index"
// recast double numindex 

*Numeracy Median Split
// summarize numindex 
// hist numindex, percent
// tabstat numindex, stat(p50)
// gen numeracysplit = numindex
// replace numeracysplit = 0 if numindex < 7
// replace numeracysplit = 1 if numindex > 7
// replace numeracysplit = 0 if numindex==7
// label var numeracysplit ///
// "Numeracy: High/Low"
// label define numeracysplit ///
// 0 "0 Low numeracy" 1 "1 High numeracy"
// label values numeracysplit numeracysplit
// recast double numeracysplit

*Political Knowledge Median Split
// summarize polknowx
// hist polknowx, percent
// tabstat polknowx, stat(p50)
// gen polknowsplit = polknowx
// replace polknowsplit = 0 if polknowx < 3 
// replace polknowsplit = 1 if polknowx > 3
// replace polknowsplit = 0 if polknowx==3
// replace polknowsplit = . if polknowx == .
// label var polknowsplit ///
// "Political Knowledge: High/Low"
// label define polknowsplit ///
// 0 "0 Low Political Knowledge" 1 "1 High Political Knowledge"
// label values polknowsplit polknowsplit
// recast double polknowsplit

********************************** Interest ************************************

*Following closely: reverse coded 
// gen debt1x = debt1 
// label var debt1x ///
// "Following debt limit debate"
// label define debt1x ///
// 1 "1 Not closely at all" 2 "2 Not very closely" 3 "3 Somewhat closely" 4 "4 Very closely" 5 "5 Extremely closely" 
// label values debt1x debt1x 
// recast double debt1x 

// gen debt101 = (debt1x-1)/4
// label var debt101 ///
// "Following debt limit debate"
// recast double debt101 

*Understand the debate: reverse coded 
// gen debt2x = debt2
// label var debt2x ///
// "Understand debt limit debate"
// label define debt2x ///
// 1 "1 Not well at all" 2 "2 Not very well" 3 "3 Somewhat well" 4 "4 Very well" 5 "5 Extremely well" 
// label values debt2x debt2x 
// recast double debt2x 

// gen debt201 = (debt2x-1)/4
// label var debt201 ///
// "Understand debt limit debate"
// recast double debt201 

*General political interest 
// gen interestx = interest 
// recode interestx (8=1)
// label var interestx ///
// "Interest"
// label define interestx ///
// 1 "1 Never" 2 "2 Some of the time" 3 "3 About half the time" 4 "4 Most of the time" 5 "5 Always"
// label values interestx interestx 
// recast double interestx 

// gen interest01 = (interestx-1)/4
// label var interest01 ///
// "Interest"
// recast double interest01

// alpha debt101 debt201 interest01, item
// factor debt101 debt201 interest01, ipf

// sumscale, f1(debt101 debt201 interest01)
// rename Factor1_average interestdebt 
// label var interestdebt ///
// "Interest in Politics/Debt Ceiling Issue"
// recast double interestdebt 

************************************ Trust *************************************

// gen trustgovtx = trustgovt
// label var trustgovtx ///
// "Trust"
// label define trustgovtx ///
// 1 "1 Never" 2 "2 Some of the time" 3 "3 About half the time" 4 "4 Most of the time" 5 "5 Always"
// label values trustgovtx trustgovtx 
// recast double trustgovtx 

// gen trustgovt01 = (trustgovtx-1)/4
// label var trustgovt01 ///
// "Trust"
// recast double trustgovt01

****************************** Authoritarianism ********************************

// recode auth3 (0=1) (1=0)
// alpha auth1 auth2 auth3 auth4, item 
// sumscale, f1(auth1 auth2 auth3 auth4) 
// rename Factor1_average author01 
// label var author01 ///
// "Authoritarianism"
// recast double author01

****************************** Need for Closure ********************************

// alpha closure_1 closure_2 closure_3 closure_4 closure_5 closure_6 closure_7 closure_8 closure_9 closure_10 closure_11 closure_12 closure_13 closure_14 closure_15, item
// sumscale, f1(closure_1 closure_2 closure_3 closure_4 closure_5 closure_6 closure_7 closure_8 closure_9 closure_10 closure_11 closure_12 closure_13 closure_14 closure_15)
// rename Factor1_average closurex 
// label var closurex ///
// "Need for Closure"
// recast double closurex 

// gen closure01 = (closurex-1)/10
// label var closure01 ///
// "Need for Closure"
// recast double closure01 

****************************** Need for Cognition ******************************

*Reverse coded 
// gen cog1 = cognition_1 
// recode cog1 (1=5) (2=4) (4=2) (5=1)
// label define cog1 ///
// 1 "1 Strongly disagree" 2 "2 Disagree" 3 "3 Neither agree nor disagree" 4 "Agree" 5 "5 Strongly agree"
// label values cog1 cog1 
// recast double cog1

// gen cog2 = cognition_2
// recode cog2 (1=5) (2=4) (4=2) (5=1)
// label define cog2 ///
// 1 "1 Strongly disagree" 2 "2 Disagree" 3 "3 Neither agree nor disagree" 4 "Agree" 5 "5 Strongly agree"
// label values cog2 cog2 
// recast double cog2

// gen cog3 = cognition_3
// recode cog3 (1=5) (2=4) (4=2) (5=1)
// label define cog3 ///
// 1 "1 Strongly disagree" 2 "2 Disagree" 3 "3 Neither agree nor disagree" 4 "Agree" 5 "5 Strongly agree"
// label values cog3 cog3 
// recast double cog3

// gen cog4 = cognition_4
// recode cog4 (1=5) (2=4) (4=2) (5=1)
// label define cog4 ///
// 1 "1 Strongly disagree" 2 "2 Disagree" 3 "3 Neither agree nor disagree" 4 "Agree" 5 "5 Strongly agree"
// label values cog4 cog4 
// recast double cog4

// gen cog5 = cognition_5
// recode cog5 (1=5) (2=4) (4=2) (5=1)
// label define cog5 ///
// 1 "1 Strongly disagree" 2 "2 Disagree" 3 "3 Neither agree nor disagree" 4 "Agree" 5 "5 Strongly agree"
// label values cog5 cog5 
// recast double cog5

// gen cog6 = cognition_6
// recode cog6 (1=5) (2=4) (4=2) (5=1)
// label define cog6 ///
// 1 "1 Strongly disagree" 2 "2 Disagree" 3 "3 Neither agree nor disagree" 4 "Agree" 5 "5 Strongly agree"
// label values cog6 cog6 
// recast double cog6

// alpha cog1 cog2 cog3 cog4 cog5 cog6, item
// sumscale, f1(cog1 cog2 cog3 cog4 cog5 cog6)
// rename Factor1_average cognitionx 
// label var cognitionx ///
// "Need for Cognition"
// recast double cognitionx

// gen cognition01 = (cognitionx-1)/4
// label var cognition01 ///
// "Need for Cognition"
// recast double cognition01

*********************************** Big Five ***********************************

*Negative pole questions reverse coded

*Extraversion 
// gen extraversion101 = (TIPI_1-1)/6
// label var extraversion101 ///
// "Extraversion"
// recast double extraversion1

// gen extraversion2x = TIPI_6
// recode extraversion2x (1=7) (2=6) (3=5) (5=3) (6=2) (7=1) 
// label var extraversion2x ///
// "Extraversion"
// recast double extraversion2x 

// gen extraversion201 = (extraversion2x-1)/6
// label var extraversion201 ///
// "Extraversion"
// recast double extraversion201

// sumscale, f1(extraversion101 extraversion201)
// rename Factor1_average extra
// label var extra ///
// "Extraversion"
// recast double extra

*Agreeableness 
// gen agreeable1x = TIPI_2
// recode agreeable1x (1=7) (2=6) (3=5) (5=3) (6=2) (7=1) 
// label var agreeable1x ///
// "Agreeableness"
// recast double agreeable1x 

// gen agreeable101 = (agreeable1x-1)/6
// label var agreeable101 ///
// "Agreeableness"
// recast double agreeable101

// gen agreeable201 = (TIPI_7-1)/6
// label var agreeable201 ///
// "Agreeableness"
// recast double agreeable201

// sumscale, f1(agreeable101 agreeable201)
// rename Factor1_average agree
// label var agree ///
// "Agreeableness"
// recast double agree

*Conscientiousness 
// gen conscientious101 = (TIPI_3-1)/6
// label var conscientious101 ///
// "Conscientiousness"
// recast double conscientious101

// gen conscientious2x = TIPI_8
// recode conscientious2x (1=7) (2=6) (3=5) (5=3) (6=2) (7=1) 
// label var conscientious2x ///
// "Conscientiousness"
// recast double conscientious2x 

// gen conscientious201 = (conscientious2x-1)/6
// label var conscientious201 ///
// "Conscientiousness"
// recast double conscientious201

// sumscale, f1(conscientious101 conscientious201)
// rename Factor1_average conscient
// label var conscient ///
// "Conscientiousness" 
// recast double conscient

*Emotional Stability/Neuroticism
// gen emotional1x = TIPI_4
// recode emotional1x (1=7) (2=6) (3=5) (5=3) (6=2) (7=1) 
// label var emotional1x ///
// "Emotional Stability"
// recast double emotional1x 

// gen emotional101 = (emotional1x-1)/6
// label var emotional101 ///
// "Emotional Stability"
// recast double emotional101

// gen emotional201 = (TIPI_9-1)/6
// label var emotional201 ///
// "Emotional Stability"
// recast double emotional201

// sumscale, f1(emotional101 emotional201)
// rename Factor1_average neuro
// label var neuro ///
// "Emotional Stability"
// recast double neuro 

*Openness to Experiences
// gen openness101 = (TIPI_5-1)/6
// label var openness101 ///
// "Openness"
// recast double openness101

// gen openness2x = TIPI_10
// recode emotional1x (1=7) (2=6) (3=5) (5=3) (6=2) (7=1) 
// label var emotional1x ///
// "Openness"
// recast double emotional1x 

// gen openness201 = (openness2x-1)/6
// label var openness201 ///
// "Openness"
// recast double openness201

// sumscale, f1(openness101 openness201)
// rename Factor1_average open
// label var open ///
// "Openness"
// recast double open 

********************************** Experiment **********************************

*Both Gain and Loss frames are coded such that 1 indicates the "expected" response according to Prospect Theory (i.e., risk averse in the domain of gains; risk-seeking in the domain of losses)

*Gain Frame
// gen gain01 = gain
// recode gain01 (2=0)
// label var gain01 ///
// "Gain Frame: Risk Averse"
// label define gain01 ///
// 0 "0 Deal B" 1 "1 Deal A"
// label values gain01 gain01 
// recast double gain01 

*Loss Frame
// gen loss01 = loss
// recode loss01 (3=0) (4=1)
// label var loss01 ///
// "Loss Frame: Risk Seeking"
// label define loss01 ///
// 0 "0 Deal A" 1 "1 Deal B"
// label values loss01 loss01 
// recast double loss01 

*Certainty 
// label var certain ///
// "Certainty"
// label define certain ///
// 1 "1 Not at all" 2 "2 A little" 3 "3 Moderately" 4 "4 Very" 5 "5 Extremely"
// label values certain certain 
// recast double certain 

// gen certain01 = (certain-1)/4
// label var certain01 ///
// "Certainty"
// recast double certain01

********************************************************************************
********************************* Main Analysis ********************************
********************************************************************************

*Drop observations based on failed attention check
drop if (colorcheck == 0) 
	
*Table 1
logit numeracysplit cognition01 age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt polknow01 closure01 author01 open conscient extra agree neuro

*Table 2
logit gain01 numeracysplit 
estat ic 

logit loss01 numeracysplit
estat ic 

logit gain01 numeracysplit cognition01 age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt polknow01 closure01 author01 open conscient extra agree neuro 
estat ic 

logit loss01 numeracysplit cognition01 age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt polknow01 closure01 author01 open conscient extra agree neuro 
estat ic 

*Figure 1
logit gain01 numeracysplit cognition01 age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt polknow01 closure01 author01 open conscient extra agree neuro 

margins, at(numeracysplit=(0 1)) 

logit loss01 numeracysplit cognition01 age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt polknow01 closure01 author01 open conscient extra agree neuro 

margins, at(numeracysplit=(0 1)) 

*Table 3
logit gain01 numeracysplit##c.cognition01 
estat ic 

logit loss01 numeracysplit##c.cognition01
estat ic 

logit gain01 numeracysplit##c.cognition01 age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt polknow01 closure01 author01 open conscient extra agree neuro 
estat ic 

logit loss01 numeracysplit##c.cognition01 age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt polknow01 closure01 author01 open conscient extra agree neuro 
estat ic 

margins, at(cognition01=(0(.0833333)1) numeracysplit=(0 1))
marginsplot, legend(col(1) pos(6) yoffset(20) size(vsmall) region(lstyle(none)))

*Table 4
logit gain01 c.polknow01##c.cognition01 numeracysplit age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt closure01 author01 open conscient extra agree neuro 
estat ic 

logit loss01 c.polknow01##c.cognition01 numeracysplit age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt closure01 author01 open conscient extra agree neuro 
estat ic 

logit gain01 numeracysplit##c.cognition01 c.polknow01##c.cognition01 c.polknow01##numeracysplit age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt closure01 author01 open conscient extra agree neuro 
estat ic 

logit loss01 numeracysplit##c.cognition01 c.polknow01##c.cognition01 c.polknow01##numeracysplit age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt closure01 author01 open conscient extra agree neuro 
estat ic 

*Figure 3 (using median split variable for political knowledge) 
logit loss01 numeracysplit##c.cognition01 polknowsplit##c.cognition01 polknowsplit##numeracysplit age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt closure01 author01 open conscient extra agree neuro 

margins, at(cognition01=(0(.0833333)1) numeracysplit=(0 1))
marginsplot, legend(col(1) pos(6) yoffset(20) size(vsmall) region(lstyle(none)))

margins, at(cognition01=(0(.0833333)1) polknowsplit=(0 1))
marginsplot, legend(col(1) pos(6) yoffset(20) size(vsmall) region(lstyle(none)))

********************************************************************************
**************************** Supplementary Materials ***************************
********************************************************************************

*Table SM1 
summarize numindex numeracysplit age01 race01 ethnicity01 gender01 income01 education01 ideology01 polknow01 closure01 cognition01 trustgovt01 interestdebt religion01 author01 open conscient extra agree neuro

*Table SM2 
summarize numeracysplit 
summarize numindex 
tabstat numindex, stat(p50)

tab n1
tab n2 
tab n3 
tab n4 
tab n5 
tab n6 
tab n7 
tab n8a 
tab n8b 
tab n9 
tab n10 

summarize n1 n2 n3 n4 n5 n6 n7 n8a n8b n9 n10
alpha n1 n2 n3 n4 n5 n6 n7 n8a n8b n9 n10, item
factor n1 n2 n3 n4 n5 n6 n7 n8a n8b n9 n10, ipf 
tetrachoric n1 n2 n3 n4 n5 n6 n7 n8a n8b n9 n10, star(.05)
factor n1 n2 n3 n4 n5 n6 n7 n8a n8b n9 n10
summarize numindex, detail

*Figure SM1 
hist numindex, percent

*Figure SM2 
hist polknowx, percent  

*Table SM3 
logit gain01 polknow01
estat ic 

logit loss01 polknow01
estat ic 

logit gain01 c.polknow01##c.cognition01 
estat ic 

logit loss01 c.polknow01##c.cognition01
estat ic 

*Table SM4 
logit gain01 numeracysplit##c.cognition01 polknowsplit##c.cognition01 polknowsplit##numeracysplit age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt closure01 author01 open conscient extra agree neuro 
estat ic 

logit loss01 numeracysplit##c.cognition01 polknowsplit##c.cognition01 polknowsplit##numeracysplit age01 race01 ethnicity01 gender01 income01 education01 religion01 pid701 trustgovt01 interestdebt closure01 author01 open conscient extra agree neuro 
estat ic 

********************************************************************************

